package com.sky.mapper;

import com.sky.anno.AutoFill;
import com.sky.entity.SetmealDish;
import com.sky.enumeration.OperationType;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface SetmealDishMapper {
    /**
     * 根据id查询
     * @param ids
     * @return
     */
    List<Long> getSetmealDishIdsByDishIds(List<Long>ids);

    /**
     * 新增套餐菜品关系
     * @param setmealDishes
     */
    @AutoFill(OperationType.INSERT)
    void insertMealWithDish(List<SetmealDish> setmealDishes);

    /**
     * 修改套餐-数据回显
     * 查询dish
     * @param setmealId
     * @return
     */
    @Select("select *from setmeal_dish where setmeal_id=#{setmealId}")
    List<SetmealDish> selectDishBySetmealId(Long setmealId);

    /**
     * 根据SetmealId删除
     * @param setmealId
     */
    @Delete("delete from setmeal_dish where setmeal_id=#{setmealId}")
    void deleteBySetmealId(Long setmealId);
}
